package me.chan.chatting.server.handler;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;
import me.chan.chatting.server.factory.SessionServiceFactory;

@Slf4j
@ChannelHandler.Sharable
public class QuitHandler extends ChannelInboundHandlerAdapter {

    @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {

        SessionServiceFactory.getInstance().unbind(ctx.channel());
        log.debug("{} logout", ctx.channel());
    }
}
